package com.ot.flink.cdc.function.sink;

import com.alibaba.fastjson.JSON;
import com.ot.flink.cdc.config.CdcTargetConfig;
import com.ot.flink.cdc.dto.TableLogDto;
import com.ot.flink.cdc.util.SpringUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.functions.sink.RichSinkFunction;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.MessageFormat;
import java.util.Properties;

/**
 * @Description: 自定义
 * @author: admin
 * @date: 2024/4/19
 */
public class CustomSink extends RichSinkFunction<TableLogDto> {

    private static Logger LOGGER = LoggerFactory.getLogger(CustomSink.class);


    @Override
    public void open(Configuration parameters) throws Exception {

    }

    @Override
    public void close() throws Exception {

    }

    @Override
    public void invoke(TableLogDto value, Context context){
        JSON json = (JSON) JSON.toJSON(value);
        LOGGER.info("{} - {}", value.getTable(), json.toString());
    }
}
